<template>
    <div>
  <h2>我是home</h2>
  <button @click="changeClick">+</button>
    </div>
</template>

<script>
import emitter from './envetBus'
import { WHY_MITT, ZL_MITT } from './constans'
export default {
    created() {
        this.deepClone([1,2,3,4])
    },
    methods: {
        changeClick() {
            emitter.emit(WHY_MITT, {'name': 'zl', age: 18})
            emitter.emit(ZL_MITT, {'name': 'zz', age: 11})
        },
        deepClone(obj) {
            if (typeof obj !== 'object') return
            let result = obj instanceof Array ? [] : {}
            for (let key in obj) {
                console.log(key)
                if (obj.hasOwnProperty(key)) {
                    result[key] = (typeof obj[key] === 'object') ? deepClone(obj[key]) : obj[key]
                }
            }
        }

    }
}
</script>

<style>

</style>